import { lazy, useEffect } from 'react'
import SSE from '@utils/sse'
const Page = lazy(()=>import('#tp/content/page-content'))
/* -------------------------------------------------------- Page Component -- */
export const Component = () => {
	useEffect(()=>{
		SSE('http://localhost:3201/sse', {
			open : see => {
				see.addEventListener('Msg', e => {
					console.log(e.lastEventId)
					console.log(e.data)
				})
			}
		})
	},[])
	
	const onSend = () => {
		window.$http.pull(null, 'tests', { loading:1 })
	}
	
	return (
		<Page>
			<button onClick={onSend}>发送消息</button>
		</Page>
	)
}

export default Component